package com.chat.controller;


import com.chat.entry.dto.group.GroupChatMessageDTO;
import com.chat.result.Result;
import com.chat.service.IGroupMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 群聊消息表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-05
 */
@Slf4j
@RestController
@Api(tags = "群聊消息聊天接口")
@RequestMapping("/api/group-message")
@RequiredArgsConstructor
public class GroupMessageController {
    private final IGroupMessageService groupMessageService;

    @ApiOperation(value = "发送群聊消息", notes = "根据群聊id给该群聊的所有用户发送消息")
    @PostMapping("/sendMessage")
    public Result sendMessage(
            @ApiParam(value = "发送消息的内容", required = true) @RequestBody GroupChatMessageDTO sendGroupMessageDTO
    ) {
        return groupMessageService.sendMessage(sendGroupMessageDTO);
    }
}
